<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // find:找到数组中满足条件的第一个元素
      const array1 = [5, 12, 8, 130, 44]
      const found = array1.find((element) => element > 50)
      console.log(found)
      let arr = [
        {
          name: '小米',
          price: 1999,
        },
        {
          name: '华为',
          price: 4999,
        },
        {
          name: '苹果',
          price: 9999,
        },
      ]
      // 知道到数组中 价格大于2000的商品
      const res = arr.find((item) => item.price > 2000)
      const res1 = arr.find((item) => item.name === '苹果')
      console.log(res)
    </script>
  </body>
</html>
